
<template>
  <div class="left-board-container">
    <div class="label-content">余额信息</div>
    <div v-if="baseData.shopMessageStatus == '1'" class="kong-content flex-column">
      <svg-icon class="kong-svg" icon-class="finance-icon-4"></svg-icon>
      <span class="kong-desc">您展示还没有开设资金账户，请开户后使用</span>
      <div class="kong-btn flex-center">
        <span class="btn-txt" v-hasPermi="['shop:acddShopMessage:again']" @click="jumpPage('actionAccount', 'add')">立即开户</span>
      </div>
    </div>
    <div v-else class="left-board-main">
      <div class="model">
        <div class="model-content ye flex-column">
          <span class="ye-label">可用余额：</span>
          <div class="money-content flex-between">
            <div class="money-val flex-normal">
              <span class="unit">￥</span>
              <span class="num">{{baseData['usableBalance'] || '0.00'}}</span>
            </div>
            <div class="btn-content" v-hasPermi="['shop:acddShopMessage:shopWithdrawal']">
              <el-button :loading="txProp['loading']" class="btn-item tx-btn flex-center" @click="showDialog('dialog-tx')">
                <span class="btn-txt">账户提现</span>
              </el-button>
            </div>
          </div>
          <div class="frezzen-content flex-normal">
            <span class="label-txt">冻结资金：</span>
            <span class="frezzen-val">{{baseData['freezeBalance'] || '0.00'}}</span>
          </div>
        </div>
      </div>
      <div class="model" v-if="baseData['shopMessage']">
        <div class="model-title">提现账户</div>
        <div class="model-content tx flex-column">
          <span class="tx-label">后续资金将提现至：</span>
          <div class="card-content flex-between">
            <div class="card-val flex-normal">
              <img :src="`data:image/jpg;base64,${baseData['logo']}`"  class="card-logo">
              <span class="card">
                {{baseData['shopMessage']['acctnoName']}} 
                （{{baseData['shopMessage']['bankCard']}}）
              </span>
            </div>
            <div class="btn-content">
              <el-button class="btn-item flex-center" 
              v-hasPermi="['shop:acddShopMessage:updateAccount']" 
              @click="showDialog('dialog-xgzh')"
              :loading="xgzhProp.isLoading">
                <span class="btn-txt">修改账号</span>
              </el-button>
              <el-button class="btn-item flex-center" 
              v-hasPermi="['shop:acddShopMessage:changePassword']"
               @click="showDialog('dialog-pwd')"
               :loading="xgmmProp.isLoading">
                <span class="btn-txt">修改支付密码</span>
              </el-button>
              <el-button :loading="wjmmProp.isLoading" class="btn-item flex-center" v-hasPermi="['shop:acddShopMessage:retrievePassword']" @click="showDialog('dialog-resetpwd')">
                <span class="btn-txt">找回密码</span>
              </el-button>
            </div>
          </div>
          <div class="warning-content flex-normal" v-if="baseData['rate']">
            <i class="desc-icon el-icon-info"></i>
            <span class="desc-txt">
              资金提现将平台将收取 {{baseData['rate']['shopWithdrawApr']}} 元/笔
              + {{baseData['rate']['shopWithdrawLpr']}} %手续费；提现后1-3个工作日到账；</span>
          </div>
        </div>
      </div>
      <div class="model">
        <div class="model-title">存管账户</div>
        <div class="model-content cg flex-column">
          <div class="item flex-between">
            <div class="item-left flex-normal">
              <span class="item-label">户名</span>
              <span class="item-val">{{baseData['accountName']}}</span>
            </div>
            <el-button :loading="cxkhProp.isLoading" class="item-btn flex-center" 
              v-hasPermi="['shop:acddShopMessage:again']"
              @click="showDialog('dialog-cxkh')">
              <span class="btn-txt">重新开户</span>
            </el-button>
          </div>
          <div class="item flex-normal">
            <span class="item-label">账号</span>
            <span class="item-val">{{baseData['accountNumber']}}</span>
          </div>
          <div class="item flex-normal">
            <!-- 分支机构 -->
            <span class="item-label">银行</span>
            <span class="item-val">{{baseData['branchOrganization']}}</span>
          </div>
          <div class="item flex-normal">
            <!-- 开户机构 -->
            <span class="item-label">支行</span>
            <span class="item-val">{{baseData['openAccountOrganization']}}</span>
          </div>
          <div class="item flex-normal">
            <span class="item-label">开户地</span>
            <span class="item-val">{{baseData['openAccountAddress']}}</span>
          </div>
          <div class="item flex-normal">
            <span class="item-label">开户行号</span>
            <span class="item-val">{{baseData['openAccountNumber']}}</span>
          </div>
        </div>
      </div>
      <div class="model">
        <div class="model-title">账户须知</div>
        <div class="model-content xz flex-column">
          <div class="item flex-normal" v-for="(desc, index) in warningList" :key="index">
            <span class="item-label">{{index + 1}}、</span>
            <span class="item-val">{{desc}}</span>
          </div>
        </div>
      </div>
    </div>
    <!-- 修改密码 -->
    <dialog-normal
      ref="dialog-pwd"
      :dialog-prop="{
          title: '支付密码设置',
          height: '400px',
          width: '800px',
          submit: '提交'
      }" @normal-submit="submitDialogPwd">
      <template #dialog-content>
        <div class="check-warning flex-normal">
          <i class="desc-icon el-icon-info"></i>
          <span class="desc-txt">密码不少于8位，需包含不连续的字母和数字</span>
        </div>
        <div class="LPay-code-container">
          <div class="flex-normal">
            <span class="Lpay-label">原密码：</span>
            <div id="ipt_pwd2" class="flex-normal ipt-pwd-content">
              <span id="LOGPASS2_SHOW" class="placehoder-txt">请输入原支付密码</span>
              <input id="LOGPASS2" class="default input_search" type="password" disabled="disabled" />
              <div id="keyboardBtn2" class="ipt_pwd_rjp default"></div>
            </div>
          </div>
          <div class="flex-normal">
            <span class="Lpay-label">新密码：</span>
            <div id="ipt_pwd3" class="flex-normal ipt-pwd-content">
              <span id="LOGPASS3_SHOW" class="placehoder-txt">请输入新支付密码</span>
              <input id="LOGPASS3" class="default input_search" type="password" disabled="disabled" />
              <div id="keyboardBtn3" class="ipt_pwd_rjp default"></div>
            </div>
            <i class="val-warning-txt">字母加数字不少于8位</i>
          </div>
          <div class="flex-normal">
            <span class="Lpay-label">手机号：</span>
            <div class="flex-normal ipt-pwd-content">
              <span> {{ phone }}</span>
            </div>
          </div>
          <div class="flex-normal">
            <span class="Lpay-label">手机验证码：</span>
            <div class="flex-normal ipt-pwd-content">
              <el-input v-model="xgmmProp['code']" placeholder="请输入手机验证码"></el-input>
              <el-button class="code-btn-unit flex-center" @click="getSmsCode('pwd')" :loading="timerObj.loading">
                <span class="btn-txt">{{timerObj.tips}}</span>
              </el-button>
            </div>
          </div>
        </div>
      </template>
    </dialog-normal>
    <!-- 提现 -->
    <dialog-normal
      ref="dialog-tx"
      :dialog-prop="{
          title: '提现',
          height: '400px',
          width: '800px',
          submit: '立即提现'
      }" @normal-submit="submitDialogTx">
      <template #dialog-content>
        <div class="LPay-code-container">
          <div class="flex-normal tx-num-content">
            <span class="Lpay-label">提现金额：</span>
            <div class="flex-column">
              <el-input placeholder="请输入提现金额" class="tx-num" v-model="txProp.money" 
              type="number" :max="parseFloat(baseData.usableBalance)" :min="0" @blur="moneyChange"></el-input>
              <span class="tx-desc">本次提现共收取手续费：{{txProp.params['serviceCharge']}}元，实际到账金额：{{txProp.params['accountMoney']}}元</span>
            </div>
          </div>
          <div class="flex-normal tx-num-content zh" v-if="baseData['shopMessage']">
            <span class="Lpay-label">到账账户</span>
            <div class="card-content flex-normal">
              <img :src="`data:image/jpg;base64,${baseData['logo']}`"  class="card-logo">
              <span class="card">
                {{baseData['shopMessage']['acctnoName']}} 
                （{{baseData['shopMessage']['bankCard']}}）
              </span>
            </div>
          </div>
          <div class="flex-normal">
            <span class="Lpay-label">支付密码：</span>
            <div id="ipt_pwd4" class="flex-normal ipt-pwd-content">
              <span id="LOGPASS4_SHOW" class="placehoder-txt">请输入支付密码</span>
              <input id="LOGPASS4" class="default input_search" type="password" disabled="disabled" />
              <div id="keyboardBtn4" class="ipt_pwd_rjp default"></div>
            </div>
          </div>
        </div>
      </template>
    </dialog-normal>
    <!-- 找回密码 -->
    <dialog-normal
      ref="dialog-resetpwd"
      :dialog-prop="{
        title: '支付密码设置',
        height: '400px',
        width: '800px',
        submit: '提交'
      }" @normal-submit="submitDialogWjmm">
      <template #dialog-content>
        <div class="check-warning flex-normal">
          <i class="desc-icon el-icon-info"></i>
          <span class="desc-txt">密码不少于8位，需包含不连续的字母和数字</span>
        </div>
        <div class="LPay-code-container">
          <div class="flex-normal">
            <span class="Lpay-label">支付密码：</span>
            <div id="ipt_pwd5" class="flex-normal ipt-pwd-content">
              <span id="LOGPASS5_SHOW" class="placehoder-txt">请输入密码</span>
              <input id="LOGPASS5" class="default input_search" type="password" disabled="disabled" />
              <div id="keyboardBtn5" class="ipt_pwd_rjp default"></div>
            </div>
            <i class="val-warning-txt">字母加数字不少于8位</i>
          </div>
          <div class="flex-normal">
            <span class="Lpay-label">确认密码：</span>
            <div id="ipt_pwd6" class="flex-normal ipt-pwd-content">
              <span id="LOGPASS6_SHOW" class="placehoder-txt">请确认密码</span>
              <input id="LOGPASS6" class="default input_search" type="password" disabled="disabled" />
              <div id="keyboardBtn6" class="ipt_pwd_rjp default"></div>
            </div>
          </div>
          <div class="flex-normal">
            <span class="Lpay-label">手机号：</span>
            <div class="flex-normal ipt-pwd-content">
              <span> {{ phone }}</span>
            </div>
          </div>
          <div class="flex-normal">
            <span class="Lpay-label">手机验证码：</span>
            <div class="flex-normal ipt-pwd-content">
              <el-input v-model="wjmmProp['verify_code']" placeholder="请输入手机验证码"></el-input>
              <el-button class="code-btn-unit flex-center" @click="getSmsCode('resetpwd')" :loading="timerObj.loading">
                <span class="btn-txt">{{timerObj.tips}}</span>
              </el-button>
            </div>
          </div>
        </div>
      </template>
    </dialog-normal>
    <!-- 重新开户 -->
    <dialog-normal
      ref="dialog-cxkh"
      :dialog-prop="{
          title: '重新开户',
          height: '400px',
          width: '800px',
          submit: '立即前往'
      }" @normal-submit="submitDialogCxkh">
      <template #dialog-content>
        <div class="LPay-code-container">
          <div class="flex-normal">
            <span class="Lpay-label">支付密码：</span>
            <div id="ipt_pwd7" class="flex-normal ipt-pwd-content">
              <span id="LOGPASS7_SHOW" class="placehoder-txt">请输入支付密码</span>
              <input id="LOGPASS7" class="default input_search" type="password" disabled="disabled" />
              <div id="keyboardBtn7" class="ipt_pwd_rjp default"></div>
            </div>
          </div>
          <div class="flex-normal">
            <span class="Lpay-label">手机号：</span>
            <div class="flex-normal ipt-pwd-content">
              <span> {{ phone }}</span>
            </div>
          </div>
          <div class="flex-normal">
            <span class="Lpay-label">手机验证码：</span>
            <div class="flex-normal ipt-pwd-content">
              <el-input v-model="cxkhProp['code']" placeholder="请输入手机验证码"></el-input>
              <el-button class="code-btn-unit flex-center" @click="getSmsCode('cxkh')" :loading="timerObj.loading">
                <span class="btn-txt">{{timerObj.tips}}</span>
              </el-button>
            </div>
          </div>
        </div>
      </template>
    </dialog-normal>
    <!-- 修改账号 -->
    <dialog-normal
      ref="dialog-xgzh"
      :dialog-prop="{
          title: '修改账号',
          height: '400px',
          width: '800px',
          submit: '立即前往'
      }" @normal-submit="submitDialogXgzh">
      <template #dialog-content>
        <div class="LPay-code-container">
          <div class="flex-normal">
            <span class="Lpay-label">手机号：</span>
            <div class="flex-normal ipt-pwd-content">
              <span> {{ phone }}</span>
            </div>
          </div>
          <div class="flex-normal">
            <span class="Lpay-label">手机验证码：</span>
            <div class="flex-normal ipt-pwd-content">
              <el-input v-model="xgzhProp['code']" placeholder="请输入手机验证码"></el-input>
              <el-button class="code-btn-unit flex-center" @click="getSmsCode('xgzh')" :loading="timerObj.loading">
                <span class="btn-txt">{{timerObj.tips}}</span>
              </el-button>
            </div>
          </div>
        </div>
      </template>
    </dialog-normal>
  </div>
</template>

<script>
import {isDecimal} from '@/utils/tools.js'
import {LLKeyBord} from '@/utils/tools.js'
import {
  getRandom, changePassword, findPasswordApply, findPasswordVerify, 
  cancelApply, sendCode, verifyCode
} from "@/api/financeManage/lpay.js";
import {
  shopWithdrawalMoney, shopWithdrawal
} from "@/api/financeManage/shop-finance.js";
export default {
  components: {
    "dialog-normal": () => import("@/rhComponents/dialog/normal-dialog"),
  },
  props: {
    baseData: {
      type: Object,
      default: {        
        shopMessageStatus: 1
      }
    },
    accountType: {
      type: String | Number,
      default: -1
    },
    phone: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      warningList: [
        "如需充值，请使用手机银行APP或者网银，打款至存管账户；",
        "您可以直接往对公账户转账，也可以通过在线网银支付；",
        "使用银行app或者对公账户向存管账户转账，仅限于工作日工作时间；",
        "网银账户充值，不受工作时间限制；但网银支付需额外承担0.2%的手续费；",
        "转账充值操作必须使用与存管账户的同名账户，不支持非同名账户转账；",
        "服务过程中，如果有任何疑问，可致电客服：400-810-0049反馈",
      ],      
      LPayProp: {
        options: {},
        passwordInstance: null,
        passwordHashInstance: null,
        pwdError: false,
      },
      xgmmProp: {
        code: '',
        isLoading: false
      },
      xgzhProp: {
        code: '',
        isLoading: false
      },
      txProp: {
        money: '0.00',
        loading: false,
        params: {},
        passwordInstance: null,
        pwdError: false
      },
      wjmmProp: {
        passwordInstance: null,
        passwordHashInstance: null,
        pwdError: false,
        verify_code: '',
        token: '',
        isLoading: false
      },
      cxkhProp: {
        passwordInstance: null,
        pwdError: false,
        code: '',
        isLoading: false
      },
      timerObj: {
        timer: null,
        seconds: 60,
        loading: false,
        tips: '获取验证码'
      }
    };
  },
  mounted(){
    let _self = this
    if(_self.timerObj.timer){
      clearInterval(_self.timerObj.timer)
      _self.timerObj.timer = null      
    }
  },
  methods: {
    jumpPage(routeName, key){
      let _self = this
      _self.$router.push({name: routeName, query: {key}})
    },    
    getRandom(){
      let _self = this
      getRandom().then(res => {
        _self.LPayProp.options = res.data
      })
    },
    startTimer(){
      let _self = this
      _self.timerObj.timer = setInterval(() => {
        _self.timerObj.seconds--
        if(_self.timerObj.seconds === 0){
          _self.timerObj.seconds = 60
          _self.timerObj.loading = false
          _self.timerObj.tips = '重新获取验证码'
          clearInterval(_self.timerObj.timer)
        }else{
          _self.timerObj.tips = `${_self.timerObj.seconds}s 后重新获取`
        }
      }, 1000)
    },
    resetTimer(){
      let _self = this
      if(_self.timerObj.timer){
        clearInterval(_self.timerObj.timer)
        _self.timerObj.timer = null
      }
      _self.timerObj.seconds = 60
      _self.timerObj.loading = false
      _self.timerObj.tips = '获取验证码'
    },
    getSmsCode (key){
      let _self = this
      _self.startTimer()
      _self.timerObj.loading = true
      _self.timerObj.seconds = 60
      if(key == 'resetpwd') return new Promise((resolve, reject) => {
        findPasswordApply().then(res => {
          let {token} = res.data
          _self.$set(_self.wjmmProp, 'token', token)
          resolve(true)
        }).catch((err) => {
          _self.timerObj.loading = false
          _self.timerObj.seconds = 60
          clearInterval(_self.timerObj.timer)
          reject(false)
        })
      })
      return new Promise((resolve, reject) => {
        sendCode().then(res => {
          // let {token} = res.data
          // _self.$set(_self.wjmmProp, 'token', token)
          _self.$message.success('短信发送成功')
          resolve(true)
        }).catch((err) => {
          _self.timerObj.loading = false
          _self.timerObj.seconds = 60
          clearInterval(_self.timerObj.timer)
          reject(false)
        })
      })
    },
    showDialog(ref){
      let _self = this
      if(ref != 'dialog-tx'){
        _self.getRandom()
      }
      _self.$nextTick(async () => {
        if(ref == 'dialog-tx'){
          _self.$router.push({name: 'adminWithdrow'})
          // _self.txProp.loading = true
          // _self.txProp['money'] = JSON.parse(JSON.stringify(parseFloat(_self.baseData['usableBalance'])))
          // _self.shopWithdrawalMoney().then(res => {            
          //   _self.$refs[ref].showDialog = true
          //   _self.txProp.loading = false
          //   setTimeout(() => {
          //     let paramsPwdTx = {
          //       click_objId: '#keyboardBtn4', 
          //       Input_texId: '#LOGPASS4',
          //       parent_objId: '#ipt_pwd4',
          //       placeholderId: '#LOGPASS4_SHOW'
          //     }
          //     const passowrdTx = LLKeyBord(paramsPwdTx, _self.LPayProp.options)          
          //     passowrdTx.initOptions()
          //     _self.txProp.passwordInstance = passowrdTx
          //   },500)
          // }).catch(() => {
          //   _self.txProp.loading = false
          // })
         
        }else if(ref == 'dialog-resetpwd'){
          _self.resetTimer()
          _self.$refs[ref].showDialog = true
          setTimeout(() => {
            let paramsPwd = {
              click_objId: '#keyboardBtn5', 
              Input_texId: '#LOGPASS5',
              parent_objId: '#ipt_pwd5',
              placeholderId: '#LOGPASS5_SHOW'
            }
            const passowrd = LLKeyBord(paramsPwd, _self.LPayProp.options, (res) => {
              _self.wjmmProp.pwdError = false
            }, (err) => {
              _self.wjmmProp.pwdError = true
              _self.$message.error('密码格式错误')
            })
            
            let paramsPwdHash = {
              click_objId: '#keyboardBtn6', 
              Input_texId: '#LOGPASS6',
              parent_objId: '#ipt_pwd6',
              placeholderId: '#LOGPASS6_SHOW'
            }
            const passowrdHash = LLKeyBord(paramsPwdHash, _self.LPayProp.options, (res) => {
              _self.wjmmProp.pwdError = false
            }, (err) => {
              _self.wjmmProp.pwdError = true
              _self.$message.error('密码格式错误')
            })
            passowrd.initOptions()
            passowrdHash.initOptions()
            _self.wjmmProp.passwordInstance = passowrd
            _self.wjmmProp.passwordHashInstance = passowrdHash
          },500)
        }else if(ref == 'dialog-pwd'){
          _self.resetTimer()
          _self.$refs[ref].showDialog = true   
          setTimeout(() => {
            let paramsPwd = {
              click_objId: '#keyboardBtn2', 
              Input_texId: '#LOGPASS2',
              parent_objId: '#ipt_pwd2',
              placeholderId: '#LOGPASS2_SHOW'
            }
            const passowrd = LLKeyBord(paramsPwd, _self.LPayProp.options, (res) => {
              _self.LPayProp.pwdError = false
            }, (err) => {
              _self.LPayProp.pwdError = true
              _self.$message.error('密码格式错误')
            })
            
            let paramsPwdHash = {
              click_objId: '#keyboardBtn3', 
              Input_texId: '#LOGPASS3',
              parent_objId: '#ipt_pwd3',
              placeholderId: '#LOGPASS3_SHOW'
            }
            const passowrdHash = LLKeyBord(paramsPwdHash, _self.LPayProp.options, (res) => {
              _self.LPayProp.pwdError = false
            }, (err) => {
              _self.LPayProp.pwdError = true
              _self.$message.error('密码格式错误')
            })
            passowrd.initOptions()
            passowrdHash.initOptions()
            _self.LPayProp.passwordInstance = passowrd
            _self.LPayProp.passwordHashInstance = passowrdHash
          }, 500)   
        }else if(ref == 'dialog-cxkh'){
          _self.resetTimer()
          _self.$refs[ref].showDialog = true
          setTimeout(() => {
            let paramsPwd = {
              click_objId: '#keyboardBtn7', 
              Input_texId: '#LOGPASS7',
              parent_objId: '#ipt_pwd7',
              placeholderId: '#LOGPASS7_SHOW'
            }
            const passowrd = LLKeyBord(paramsPwd, _self.LPayProp.options, (res) => {
              _self.cxkhProp.pwdError = false
            }, (err) => {
              _self.cxkhProp.pwdError = true
              _self.$message.error('密码格式错误')
            })
            
            passowrd.initOptions()
            _self.cxkhProp.passwordInstance = passowrd
          }, 500)
        }else if(ref == 'dialog-xgzh'){
          _self.resetTimer()
          _self.$refs[ref].showDialog = true
        }
      })
    },
    async submitDialogPwd(){
      let _self = this
      let {passwordInstance, passwordHashInstance, pwdError} = _self.LPayProp
      let {code} = _self.xgmmProp
      let vm = _self.$refs['dialog-pwd']
      if(pwdError){
        vm.loading = false
        return _self.$message.error('密码格式错误')
      }
      // 获取国密密文
      passwordInstance.setRandKey(_self.LPayProp.options.random_value) // 先设置随机key
      const password = passwordInstance.getOutputSM() // 国密加密密码

      // 获取国密密文
      passwordHashInstance.setRandKey(_self.LPayProp.options.random_value) // 先设置随机key
      const password_new = passwordHashInstance.getOutputSM() // 国密加密密码

      const hash = passwordInstance.getHash() // RSA加密密码
      const hash2 = passwordHashInstance.getHash() // RSA加密密码
      if(!hash || hash == '') {
        vm.loading = false
        return _self.$message.error('原密码不能为空')
      }
      if(!hash2 || hash2 == '') {
        vm.loading = false
        return _self.$message.error('新密码不能为空')
      }
      if(password === password_new) {
        vm.loading = false
        return _self.$message.error('新密码与原密码相同')
      }
      if(!code) {
        vm.loading = false
        return _self.$message.error('验证码不能为空')
      }


      let params = {
        password: password,
        random_key: _self.LPayProp.options['random_key'],
        password_new: password_new,
        code
      }
      await changePassword(params).then(res => {
        vm.showDialog = false
        _self.$message.success('操作成功')
      }).catch(err => {
        _self.getRandom()
      }).finally(() => {
        vm.loading = false
      })
    },
    async shopWithdrawalMoney(){
      let _self = this, isSuccess = false
      await shopWithdrawalMoney({money: _self.txProp['money'] || '0.00'}).then(res => {
        _self.txProp.params = res.data
        _self.isSuccess = true
      })
      return isSuccess
    },
    moneyChange(){
      let _self = this
      let {money} = _self.txProp
      if(!isDecimal(money)) {
        return _self.$message.error('请输入正确金额')
      }
      if(parseFloat(money) > parseFloat(_self.baseData['usableBalance'])) {
        return _self.$message.error('提现金额不能超过余额')
      }
      _self.shopWithdrawalMoney()
    },
    submitDialogTx(){
      let _self = this
      let {passwordInstance, money} = _self.txProp
      let vm = _self.$refs['dialog-tx']
      // 获取国密密文
      passwordInstance.setRandKey(_self.LPayProp.options.random_value) // 先设置随机key
      const password = passwordInstance.getOutputSM() // 国密加密密码

      const hash = passwordInstance.getHash() // RSA加密密码
      if(!hash || hash == '') {
        vm.loading = false
        return _self.$message.error('密码不能为空')
      }

      if(!isDecimal(money)) {
        vm.loading = false
        return _self.$message.error('请输入正确金额')
      }
      if(parseFloat(money) > parseFloat(_self.baseData['usableBalance'])) {
        vm.loading = false
        return _self.$message.error('提现金额不能超过余额')
      }
      let props = {
        password: password,
        random_key: _self.LPayProp.options['random_key'],
        money: money || '0.00'
      }
      shopWithdrawal(props).then(res => {
        vm.showDialog = false
        _self.$message.success('操作成功')
        _self.$router.replace({name: 'FinanceStore'})
      }).catch(err => {
        _self.getRandom()
      }).finally(() => {
        vm.loading = false
      })
    },
    submitDialogWjmm(){
      let _self = this
      let {passwordInstance, passwordHashInstance, pwdError, verify_code, token} = _self.wjmmProp
      let vm = _self.$refs['dialog-resetpwd']
      if(pwdError){
        vm.loading = false
        return _self.$message.error('密码格式错误')
      }
      // 获取国密密文
      passwordInstance.setRandKey(_self.LPayProp.options.random_value) // 先设置随机key
      const password = passwordInstance.getOutputSM() // 国密加密密码
      const rsaPassword = passwordInstance.getOutput() // RSA加密密码
      // hash用于比对密码是否一致，同一个密码加密密文可能不同，hash一定相同
      const hash = passwordInstance.getHash() // RSA加密密码
      const hash2 = passwordHashInstance.getHash() // RSA加密密码
      if(!hash || hash == '') {
        vm.loading = false
        return _self.$message.error('密码不能为空')
      }
      if(hash != hash2) {
        vm.loading = false
        return _self.$message.error('密码输入不一致')
      }
      if(!verify_code || verify_code == '') {
        vm.loading = false
        return _self.$message.error('验证码不能为空')
      }
      let params = {
        token: token,
        password: password,
        random_key: _self.LPayProp.options['random_key'],
        verify_code: verify_code
      }
      // return vm.loading = false
      findPasswordVerify(params).then(res => {
        vm.showDialog = false
        _self.$message.success('操作成功')
      }).catch(err => {
        _self.getRandom()
      }).finally(() => {
        vm.loading = false
      })
    },
    submitDialogCxkh(){
      let _self = this
      let {passwordInstance, pwdError, code} = _self.cxkhProp
      let vm = _self.$refs['dialog-cxkh']
      if(pwdError){
        vm.loading = false
        return _self.$message.error('密码格式错误')
      }
      // 获取国密密文
      passwordInstance.setRandKey(_self.LPayProp.options.random_value) // 先设置随机key
      const password = passwordInstance.getOutputSM() // 国密加密密码
      // hash用于比对密码是否一致，同一个密码加密密文可能不同，hash一定相同
      const hash = passwordInstance.getHash() // RSA加密密码
      if(!hash || hash == '') {
        vm.loading = false
        return _self.$message.error('密码不能为空')
      }
      if(!code || code == '') {
        vm.loading = false
        return _self.$message.error('验证码不能为空')
      }
      let params = {
        password: password,
        random_key: _self.LPayProp.options['random_key'],
        code: code
      }
      // return vm.loading = false
      cancelApply(params).then(res => {
        vm.showDialog = false
        _self.jumpPage('actionAccount', 'reset')
        _self.$message.success('操作成功')
      }).catch(err => {
        _self.getRandom()
      }).finally(() => {
        vm.loading = false
      })
    },
    submitDialogXgzh(){
      let _self = this
      let {code} = _self.xgzhProp
      let vm = _self.$refs['dialog-xgzh']      
      if(!code || code == '') {
        vm.loading = false
        return _self.$message.error('验证码不能为空')
      }
      let params = {
        code: code
      }
      verifyCode(params).then(res => {
        vm.showDialog = false
        _self.jumpPage(_self.accountType == 1 ? 'updateCardPerson' : 'updateCardCompany')
        _self.$message.success('操作成功')
      }).catch(err => {
        _self.getRandom()
      }).finally(() => {
        vm.loading = false
      })
    },
  }
};
</script>
<style scoped lang="scss">
.card-content{
  margin-top: vh(16);
  .btn-content{
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
  }
  .card-logo{
    width: vw(20);
    height: vh(20);
    margin-right: vw(10);
    object-fit: scale-down;
  }
  .card{
    color: #444444;
    font-size: vh(12);
  }
  .btn-item{
    height: vh(36);
    padding: 0 vw(12);
    border-radius: vh(3);
    cursor: pointer;
    margin-left: vw(17);
    background: #F4F4F4;
    border: none;
    &:first-child{
      margin-left: 0;
    }
    .btn-txt{
      text-align: center;
      color: #0003AA;
      font-size: vh(12);
    }
  }
}
.tx-num-content ::v-deep{
  align-items: flex-start;
  margin-bottom: 50px;
  .el-input__inner{
    font-size: 26px !important;
    font-weight: 500;
    color: #3D3D3D;
  }
  &.zh{
    align-items: center;
  }
  .card-content{
    margin-top: 0;
  }
  .tx-desc{
    background: rgba(248, 213, 9, 0.1);
    color: #0003AA;
    font-size: 13px;
    border-radius: 3px;
    padding: 6px 10px;
    margin-top: 14px;
  }
}
.left-board-container {
  width: 45%;
  padding-right: vw(30);
  .kong-content{
    margin-top: vh(100);
    align-items: center;
    .kong-svg{
      width: vh(180);
      height: vh(180);
    }
    .kong-desc{
      color: #3D3D3D;
      font-size: 13px;
      margin-top: vh(15);
    }
    .kong-btn{
      height: vh(40);
      padding: 0 vw(35);
      background: rgba(0, 3, 170, 0.1);
      margin-top: vh(20);
      border-radius: vh(3);
      cursor: pointer;
      .btn-txt{
        font-size: 13px;
        color: #0003AA;
      }
    }
  }
  .label-content{
    font-size: 13px;
    color: #3D3D3D;
  }
  .left-board-main{
    margin-top: vh(15);
  }
  .model{
    margin-bottom: vh(25);
    .warning-content{
      margin-top: vh(30);
      .desc-icon{
        color: #F7B212;
      }
      .desc-txt{
        margin-left: vw(10);
        font-size: vh(12);
        color: #7F7F7F;
      }
    }
    .model-title{
      font-size: vh(12);
      color: #3D3D3D;
      margin-bottom: vh(15);
    }
    .model-content{
      background: #F8F8F8;
      border-radius: vh(3);
      overflow: hidden;
      padding: vh(15) vw(15);
    }
    .ye{
      .ye-label{
        color: #7F7F7F;
        font-size: vh(12);
      }
      .money-content{
        margin-top: vh(16);
        .unit{
          color: #3D3D3D;
          font-size: 13px;
          margin-right: vw(15);
        }
        .num{
          color: #3E3E3E;
          font-size: vh(24);
        }
        .btn-item{
          height: vh(36);
          padding: 0 vw(20);
          border-radius: vh(3);
          cursor: pointer;
          margin-left: vw(17);
          &:first-child{
            margin-left: 0;
          }
          &.cz-btn{
            background-color: #EA0000;
          }
          &.tx-btn{
            background-color: #0003AA;
          }
          .btn-txt{
            text-align: center;
            color: #fff;
            font-size: vh(12);
          }
        }
      }
      .frezzen-content{
        margin-top: vh(10);
        .label-txt{
          color: #949494;
          font-size: vh(12);
          margin-right: vh(8);
        }
        .frezzen-val{
          font-size: vh(12);
          color: #444444;
        }
      }
    }
    .tx{
      .tx-label{
        color: #7F7F7F;
        font-size: vh(12);
      }
    }
    .cg{
      .item{
        margin-bottom: vh(15);
        &:last-child{
          margin-bottom: 0;
        }
        .item-label{
          color: #3D3D3D;
          font-size: 13px;
          width: vw(150);
        }
        .item-val{
          color: #3D3D3D;
          font-size: 13px;
        }
      }
      .item-btn{
        height: vh(36);
        padding: 0 vw(12);
        border-radius: vh(3);
        cursor: pointer;
        background-color: #F4F4F4;
        .btn-txt{
          text-align: center;
          color: #0003AA;
          font-size: vh(12);
        }
      }
    }
    .xz{
      background-color: #fff;
      padding: 0;
      .item{
        margin-bottom: vh(6);
        &:last-child{
          margin-bottom: 0;
        }
        .item-label, .item-val{
          color: #3D3D3D;
          font-size: 13px;
        }
      }
    }
  }
}
.LPay-code-container ::v-deep{
  .el-input__inner{
    border: none;
  }
  .code-btn-unit{
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    background: rgba(0, 3, 170, 0.1);
    border-radius: vh(3);
    height: vh(36);
    padding: 0 vw(15);
    .btn-txt{
      font-size: 13px;
      color: #0003AA;
    }
  }
  .ipt-pwd-content{
    height: 60px;
    position: relative;
    width: 60%;
    border-bottom: 1px solid #D8D8D8;
    margin-bottom: 10px;
    .placehoder-txt{
      color: #999;
      font-size: 13px;
    }
  }
  .Lpay-label{
    font-size: 13px;
    width: 120px;
  }

}
.check-warning{
  padding-left: vw(20);
  .desc-icon{
    color: #F7B212;
  }
  .desc-txt{
    margin-left: vw(10);
    font-size: vh(12);
    color: #7F7F7F;
  }
}
.val-warning-txt{
  font-size: 12px;
  font-style: normal;
  color: red;
  text-wrap: nowrap;
}
</style>